package handler

import (
	"context"
	"github.com/cloudwego/hertz/pkg/app"
	"github.com/cloudwego/hertz/pkg/protocol/consts"
	"github.com/ezcloud/ezapp/pkg/core/pass"
	"github.com/ezcloud/ezapp/pkg/core/views"
)

func AuthLogin(ctx context.Context, c *app.RequestContext) {
	pe := pass.NewArgon2Pwd()
	rawp := c.Param("p")
	// TODO: 加载用户
	v, _ := pe.Encode("admin1234")

	c.PureJSON(consts.StatusOK, views.NewSuccessH(pe.Matches(rawp, v)))
}
